package com.zub.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * A simple facade of a HashMap which provides simple set/get and an environment name
 *
 * @author miken
 * @version 1.0 Jul 16, 2009
 */
public class Environment {
    private String name;
    private Map<String, String> properties;
    private static final String HELP = "help"; //if we ever have more than one reserved property, change this to a list

    public Environment(String name) {
        this.name = name;
        properties = new HashMap();
    }

    public Environment() {
        properties = new HashMap();
    }

    public String get(String property) {
        return properties.get(property);
    }

    public void set(String property, String value) {
        assert !property.equals(HELP) : "the property 'help' is reserved and should never be configured via configer";
        properties.put(property, value);
    }

    public Set<String> keySet() {
        Set<String> keySet =  properties.keySet();
        return keySet;
    }

    public boolean containsKey(String property) {
        return properties.containsKey(property);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * Returns the Map which contians all of the configured properties for this environment
     * @return 
     */
    public Map<String, String> toMap() {
        return properties;
    }
}
